home *** CD-ROM | disk | FTP | other *** search
/ ETO Development Tools 4 / ETO Development Tools 4.iso / Tools - Objects / MacApp / MacApp 3.0a2 / CPlusIncludes / Aliases.h < prev    next >
Text File  |  1991-05-01  |  6KB  |  139 lines

  1. /************************************************************
  2.  
  3. Created: Monday, January 28, 1991 at 12:55 PM
  4.     Aliases.h
  5.     C Interface to the Macintosh Libraries
  6.  
  7.  
  8.         Copyright Apple Computer, Inc.    1989-1990
  9.         All rights reserved
  10.  
  11. ************************************************************/
  12.  
  13.  
  14. #ifndef __ALIASES__
  15. #define __ALIASES__
  16.  
  17. #ifndef __TYPES__
  18. #include <Types.h>
  19. #endif
  20.  
  21. #ifndef __APPLETALK__
  22. #include <AppleTalk.h>
  23. #endif
  24.  
  25. #ifndef __FILES__
  26. #include <Files.h>
  27. #endif
  28.  
  29.  
  30. enum {
  31.  
  32.  
  33. #define rAliasType 'alis'                                           /* Aliases are stored as resources of this type */
  34.  
  35. /* define alias resolution action rules mask */
  36.  
  37.     kARMMountVol = 0x00000001,                                      /* mount the volume automatically */
  38.     kARMNoUI = 0x00000002,                                          /* no user interface allowed during resolution */
  39.     kARMMultVols = 0x00000008,                                      /* search on multiple volumes */
  40.     kARMSearch = 0x00000100,                                        /* search quickly */
  41.     kARMSearchMore = 0x00000200,                                    /* search further */
  42.     kARMSearchRelFirst = 0x00000400,                                /* search target on a relative path first */
  43.  
  44. /* define alias record information types */
  45.     asiZoneName = -3,                                               /* get zone name */
  46.     asiServerName = -2,                                             /* get server name */
  47.     asiVolumeName = -1,                                             /* get volume name */
  48.     asiAliasName = 0,                                               /* get aliased file/folder/volume name */
  49.     asiParentName = 1                                               /* get parent folder name */
  50.  
  51. };
  52.  
  53. /* define the alias record that will be the blackbox for the caller */
  54. struct AliasRecord {
  55.     OSType userType;                                                /* appl stored type like creator type */
  56.     unsigned short aliasSize;                                       /* alias record size in bytes, for appl usage */
  57. };
  58.  
  59. typedef struct AliasRecord AliasRecord;
  60. typedef AliasRecord *AliasPtr, **AliasHandle;
  61.  
  62.  
  63. typedef short AliasInfoType;                                        /* alias record information type */
  64. typedef pascal Boolean (*AliasFilterProcPtr) (CInfoPBPtr cpbPtr,    /*I*/
  65. Boolean *quitFlag,                                                  /*O*/
  66. Ptr yourDataPtr);                                                   /*I*/
  67.  
  68. #ifdef __cplusplus
  69. extern "C" {
  70. #endif
  71. /*  create a new alias between fromFile-target and return alias record handle  */
  72. pascal OSErr NewAlias(const FSSpec* fromFile,        // May be NULL
  73.                       const FSSpec& target,
  74.                       AliasHandle& alias)
  75.     = {0x7002,0xA823}; 
  76. /* create a minimal new alias for a target and return alias record handle */
  77. pascal OSErr NewAliasMinimal(const FSSpec& target,
  78.                              AliasHandle& alias)
  79.     = {0x7008,0xA823}; 
  80. /* create a minimal new alias from a target fullpath (optional zone and server name) and return alias record handle  */
  81. pascal OSErr NewAliasMinimalFromFullPath(short fullPathLength,
  82.                                          const unsigned char *fullPath,
  83.                                          ConstStr32Param zoneName,
  84.                                          ConstStr31Param serverName,
  85.                                          AliasHandle& alias)
  86.     = {0x7009,0xA823}; 
  87. #define NewAliasMinimalFromFullpath NewAliasMinimalFromFullPath
  88.  
  89. /* given an alias handle and fromFile, resolve the alias, update the alias record and return aliased filename and wasChanged flag. */
  90. pascal OSErr ResolveAlias(const FSSpec *fromFile,
  91.                           AliasHandle alias,
  92.                           FSSpec& target,
  93.                           Boolean& wasChanged)
  94.     = {0x7003,0xA823}; 
  95. /* given an alias handle and an index specifying requested alias information type, return the information from alias record as a string. */
  96. pascal OSErr GetAliasInfo(const AliasHandle alias,
  97.                           AliasInfoType index,
  98.                           Str63& theString)
  99.     = {0x7007,0xA823}; 
  100.  
  101. /* 
  102.      given a file spec, return target file spec if input file spec is an alias.
  103.         It resolves the entire alias chain or one step of the chain.  It returns
  104.         info about whether the target is a folder or file; and whether the input
  105.         file spec was an alias or not. 
  106. */
  107.  
  108. pascal OSErr ResolveAliasFile(FSSpec& theSpec,
  109.                               Boolean resolveAliasChains,
  110.                               Boolean& targetIsFolder,
  111.                               Boolean& wasAliased)
  112.     = {0x700C,0xA823}; 
  113.  
  114. /* 
  115.       Low Level Routines 
  116.     given an alias handle and fromFile, match the alias and return aliased filename(s) and needsUpdate flag
  117. */
  118.  
  119. pascal OSErr MatchAlias(const FSSpec& fromFile,
  120.                         unsigned long rulesMask,
  121.                         const AliasHandle alias,
  122.                         short& aliasCount,
  123.                         FSSpecArrayPtr aliasList,
  124.                         Boolean& needsUpdate,
  125.                         AliasFilterProcPtr aliasFilter,
  126.                         void *yourDataPtr)
  127.     = {0x7005,0xA823}; 
  128. /* given a fromFile-target pair and an alias handle, update the lias record pointed to by alias handle to represent target as the new alias. */
  129. pascal OSErr UpdateAlias(const FSSpec& fromFile,
  130.                          const FSSpec& target,
  131.                          AliasHandle alias,
  132.                          Boolean& wasChanged)
  133.     = {0x7006,0xA823}; 
  134. #ifdef __cplusplus
  135. }
  136. #endif
  137.  
  138. #endif
  139.